//
//  AlarmDetailCell.m
//  Voice2AlarmNote
//
//  Created by onemade on 14-10-28.
//  Copyright (c) 2014年 CNPC. All rights reserved.
//

#import "AlarmDetailCell.h"

@implementation AlarmDetailCell

- (void)awakeFromNib {
}
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        // 初始化时加载collectionCell.xib文件
        NSArray *arrayOfViews = [[NSBundle mainBundle] loadNibNamed:@"AlarmDetailCell" owner:self options:nil];
        
        // 如果路径不存在，return nil
        if (arrayOfViews.count < 1)
        {
            return nil;
        }
        // 如果xib中view不属于UICollectionViewCell类，return nil
        if (![[arrayOfViews objectAtIndex:0] isKindOfClass:[UICollectionViewCell class]])
        {
            return nil;
        }
        // 加载nib
        self = [arrayOfViews objectAtIndex:0];
    }
    return self;
}

- (void)customAction:(id)sender {
    if([self.delegate respondsToSelector:@selector(customAction:forCell:)]) {
        [self.delegate customAction:sender forCell:self];
    }
}

// Must implement this method either here or in the UIViewController
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
    if (action == @selector(customAction:)) {
        return YES;
    }
    return NO;
}
@end
